import { Meaning } from "."

/** 习题类型 */
export enum ExerciseType {
    /** 学新单词第一次出现的习题，显示英文单词，选择中文释义 */
    NEW_WORD_EXERCISE,

    /** 选择声音对应的单词的中文释义 */
    PRONOUNCE_CHOICE_CHINESE_EXERCISE,

    /** 显示中文释义，说出对应英文单词 */
    CHINESE_PRONOUNCE_ENGLISH_EXERCISE,

    /** 显示英文单词，选择中文释义 */
    ENGLISH_CHOICE_CHINESE_EXERCISE,

    /** 显示中文，选择英文单词 */
    CHINESE_CHOICE_ENGLISH_EXERCISE,

    /** 显示中文释义，拼写单词 */
    CHINESE_SPELLING_ENGLISH_EXERCISE,

    // 9. 英文填空（显示中文翻译，填入英文句子中缺少的单词）
    // 10. 连线 （显示几组单词和对应释义，可用于区分相似单词）
    // 11. 英句 选中（显示英文句子，选择单词在句子中对应的中文释义）
    // 12. 中句 翻译英
    // 13. 英句 翻译中
}

export type Exercise =
    | NewWordExercise
    | PronounceChoiceChineseExercise
    | ChinesePronounceEnglishExercise
    | EnglishChoiceChineseExercise
    | ChineseChoiceEnglishExercise
    | ChineseSpellingEnglishExercise

export interface NewWordExercise {
    word: string
    type: ExerciseType.NEW_WORD_EXERCISE
    options: string[]
    correctOption: number
    timekeeping?: number
    result?: number
    resultCorrect?: boolean
}

export interface EnglishChoiceChineseExercise {
    word: string
    type: ExerciseType.ENGLISH_CHOICE_CHINESE_EXERCISE
    meaning: Meaning
    options: string[]
    correctOption: number
    timekeeping?: number
    result?: number
    resultCorrect?: boolean
}

export interface ChineseChoiceEnglishExercise {
    word: string
    type: ExerciseType.CHINESE_CHOICE_ENGLISH_EXERCISE
    meaning: Meaning
    options: string[]
    correctOption: number
    timekeeping?: number
    result?: number
    resultCorrect?: boolean
}

export interface PronounceChoiceChineseExercise {
    word: string
    type: ExerciseType.PRONOUNCE_CHOICE_CHINESE_EXERCISE
    options: string[]
    correctOption: number
    timekeeping?: number
    result?: number
    resultCorrect?: boolean
}

export interface ChinesePronounceEnglishExercise {
    word: string
    type: ExerciseType.CHINESE_PRONOUNCE_ENGLISH_EXERCISE
    timekeeping?: number
    result?: string
    resultCorrect?: boolean
}

export interface ChineseSpellingEnglishExercise {
    word: string
    type: ExerciseType.CHINESE_SPELLING_ENGLISH_EXERCISE
    timekeeping?: number
    result?: string
    resultCorrect?: boolean
}
